"""
@Name:numpy-practice1.py
@Auth:YJ
@Date:2023/11/5
"""
import random

import numpy as np

t1 = np.array([1, 2, 3])
print(t1)
print(type(t1))
t3 = np.arange(4, 10, 2)
print(t3)
print(t3.dtype)
# numpy 中的数据类型
t4 = np.array(range(4, 8, 1), dtype="i1")
print(t4)
print(t4.dtype)
# 调整数据类型
t5 = t4.astype("bool")
print(t5)
print(t5.dtype)

# numpy中的小数
t6 = np.array([random.random() for i in range(10)])  # 生成10个小数

print(t6)
print(t6.dtype)

# 取两位小数
t7 = np.round(t6, 2)
print(t7)
